
	/* 0-"未制作"
	1-"制作中"
	2-"已完成"
	3-"缺菜"
	4-"退菜"
	 */
	

		//	隐藏弹出层
function guanbi() {
	$(".tanchu-bg").hide();
	$(".tanchu").hide();
	location.reload();
}

//显示弹出层
function xianshi() {
	var height = document.body.scrollHeight;
	$(".tanchu-bg").attr("height", height);
	$(".tanchu-bg").show();
	$(".tanchu").show();
}

//详情界面
$(function() {
	$(".xq").click(function() {
		var dingdanId = $(this).attr("did");
		var status = $(this).attr("dst");

		//console.log(dingdanId);
		//console.log(status);

		var path = "../dingdan/dingdandatashow?dingdan=" + dingdanId;
		$("#frame1").attr('src', path);
		xianshi();
	});

	$(".selectedd").change(function() {
		var result = $(this).children('option:selected').attr("status");
		console.log(result);
		if (result != null) {
			location.href = '../dingdan/searchBySelectInfo?pageNow=1&pageSize=10&status=' + result;
		}
	});

	//结账 JQ带双符号 JS单符号
	$(".jiezhang").click(function() {
		var a = $(this).attr("did");
		var status = $(this).attr("statu");
		//console.log(a);
		//console.log(status);
		layer.confirm("确定结账吗？", {
			btn : [ '确定', '取消' ]
		}, function() {
			$.ajax({
				url : '../dingdan/updatecompletion',
				data : {
					dingdanId : a,
					status : status
				},
				type : 'post',
				dataType : 'json',
				success : function(data) {
					var index = layer.load(0, {
						shade : false
					});
					//console.log(data.result);控制台输出
					if (data.result != null) {
						layer.msg(data.result, {
							icon : 1,
							time : 2000
						}, function() {
							layer.close(index);
							location.reload();
							return;
						});
					}
				},
				error : function(data) {
					if (data.message != null) {
						layer.msg(data.message, {
							icon : 2,
							time : 3000
						}, function() {
							location.reload();
						});
						return;
					}
				}
			});
		});
	});

	$(".quxiao").click(function() {
		var a = $(this).attr("did");
		var status = $(this).attr("statu");
		layer.confirm("想要取消" + a + "这个订单？", {
			btn : [ '确定', '取消' ]
		}, function() {
			$.ajax({
				url : '../dingdan/updatecompletion',
				data : {
					dingdanId : a,
					status : status
				},
				type : 'post',
				dataType : 'json',
				success : function(data) {
					var index = layer.load(0, {
						shade : false
					});
					//console.log(data.result);控制台输出
					if (data.result != null) {
						layer.msg(data.result, {
							icon : 1,
							time : 2000
						}, function() {
							layer.close(index);
							location.reload();
							return;
						});
					}
				},
				error : function(data) {
					if (data.message != null) {
						layer.msg(data.message, {
							icon : 2,
							time : 3000
						}, function() {
							location.reload();
						});
						return;
					}
				}
			});
		});
	});

	/**
	 * 查看所有
	 */ 
	$(".cai a input").click(function(){
		location.href="../dingdan/dingdanManager?pageNow=1&pageSize=10";
	});
	
	
	
});